﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.SheepRescissionCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepRescissionCommandHandler
{
    /// <summary>
    /// 羊只转舍中介者
    /// </summary>
    public class GetSheepRescissionCommandHandler : IRequestHandler<GetSheepRescissionCommand, Results<PageOutput<SheepRescissionOutput>>>
    {
        private readonly ISheepRescissionService _shepRescissionService;

        public GetSheepRescissionCommandHandler(ISheepRescissionService sheepRescissionService)
        {
            _shepRescissionService = sheepRescissionService;
        }
        public async Task<Results<PageOutput<SheepRescissionOutput>>> Handle(GetSheepRescissionCommand request, CancellationToken cancellationToken)
        {
            var page = await _shepRescissionService.GetSheepRescission(request.input);
            return Results<PageOutput<SheepRescissionOutput>>.DataResult(page);
        }
    }
}
